//
//  InterceptControlViewController.m
//  BSStatDemo
//
//  Created by quanxiong on 16/5/4.
//  Copyright © 2016年 BeachSon. All rights reserved.
//

#import "InterceptControlViewController.h"

@interface InterceptControlViewController ()

@end

@implementation InterceptControlViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    /**
     *  对于按钮, 当调用过 addTarget:action:forControlEvents: 方法后将记录此按钮的 touch 事件
     *  事件的名称是 eventKey
     *  对于 UIButton/UITextField/UIViewController 默认 eventKey 分别是
     *  title/placeholder/class name
     */
    [self.testButton setTitle:@"按钮名称" forState:UIControlStateNormal];
    [self.testButton addTarget:self action:@selector(pressButton:) forControlEvents:UIControlEventTouchUpInside];
    /**
     *  除了特定方法外, 还可以设置 needTelemetry 属性告知是否记录该控件 touch 事件
     */
    [self.testSlider setValue:@YES forKey:@"needTelemetry"];
    [self.testSlider setValue:@"自定义名称，默认无名称将不记录" forKey:@"eventKey"];
    /**
     *  默认无名称将不记录
     */
    [self.testSwitch setValue:@YES forKey:@"needTelemetry"];
}

- (void)pressButton:(UIButton *)button {
    NSLog(@"%s", __func__);
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
